<?php

class FeedbackController extends ControllerBase {

    /**
     * 新增用户反馈 [POST]
     * 接口请求地址：/feedback/add/
     * @param int $uid 用户Id
     * @param string $feedback 反馈内容
     * @example 返回结果：{"retcode":0,"retmsg":Success"}
     *
     */
    public function addAction() {
        $uid = $this->request->getPost('uid');
        $feedback = $this->request->getPost('feedback');
        if ($uid > 0 && $feedback != '') {
            $fb = new FeedBack();
            $fb->uid = $uid;
            $fb->feedback = $feedback;
            $fb->ftime = date('Y-m-d H:i:s');
            $fb->save();
            $this->echoSuccess();
        } else {
            $this->echoErrcode(ErrorCode::$ERR_PARAMS_ERROR);
        }
    }

}
